<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商城后台管理</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/Ionicons/css/ionicons.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/adminlte/css/AdminLTE.min.css}">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" th:href="@{/adminlte/css/skins/_all-skins.min.css}">
    <link rel="stylesheet" th:href="@{/bootstrap-table/bootstrap-table.css}">
    <link rel="stylesheet" th:href="@{/adminlte/css/toastr.min.css}">

    <link rel="stylesheet" th:href="@{/css/fileinput.css}">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js}"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js}"></script>
    <![endif]-->


    <!-- jQuery 3 -->
    <script th:src="@{/adminlte/bower_components/jquery/dist/jquery.min.js}"></script>
    <!-- Bootstrap 3.3.7 -->
    <script th:src="@{/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
    <!-- FastClick -->
    <script th:src="@{/adminlte/bower_components/fastclick/lib/fastclick.js}"></script>
    <!-- AdminLTE App -->
    <script th:src="@{/adminlte/js/adminlte.min.js}"></script>
    <!-- AdminLTE for demo purposes -->
    <script th:src="@{/adminlte/js/demo.js}"></script>
    <script th:src="@{/bootstrap-table/bootstrap-table.min.js}"></script>
    <script th:src="@{/bootstrap-table/locale/bootstrap-table-zh-CN.js}"></script>
    <script th:src="@{/js/fileinput.js}"></script>
    <script th:src="@{/js/theme.js}"></script>
    <script th:src="@{/js/zh.js}"></script>

    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    <link rel="stylesheet" type="text/css" th:href="@{/css/sweetalert.css}">
    <script th:src="@{/js/sweetalert.min.js}"></script>
    <link rel="stylesheet" th:href="@{/css/templatemo-style.css}">
    <script type="text/javascript" th:src="@{/js/bootstrap-filestyle.min.js}"></script>
</head>



<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <div th:replace="commons/public::toppublic"></div>
    <!-- Left side column. contains the logo and sidebar -->
    <div th:replace="commons/public::leftpublic"></div>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <div class="templatemo-flex-row">
            <!-- Main content -->
            <div class="templatemo-content col-1 light-gray-bg">
                <div class="templatemo-content-container">
                    <div class="templatemo-content-widget white-bg">
                        <h2 class="margin-bottom-10">添加商品</h2>
                        <p>商品的一些基本信息</p>
                        <form th:action="@{/goods/addGoodsSuccess}" class="templatemo-login-form" method="post" enctype="multipart/form-data">
                            <div class="row form-group">
                                <div class="col-lg-12 form-group">
                                    <label class="control-label" for="inputWithSuccess">商品名称</label>
                                    <input type="text" class="form-control" id="inputWithSuccess" name="goodsname">
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-lg-6 form-group">
                                    <label class="control-label" for="inputWithWarning">价格</label>
                                    <input type="number" class="form-control" id="inputWithWarning" name="price">
                                </div>
                                <div class="col-lg-6 form-group">
                                    <label class="control-label" for="inputWithError">数量</label>
                                    <input type="number" class="form-control" id="inputWithError" name="num">
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-lg-12 form-group">
                                    <label class="control-label" for="inputNote">商品描述</label>
                                    <textarea class="form-control" id="inputNote" rows="3" name="description"></textarea>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-lg-6 col-md-6 form-group">
                                    <label class="control-label templatemo-block">类别</label>
                                    <select class="form-control" id="category" name="category">
                                        <option  th:each="list:${categories}" th:value="${list.cateid}" th:text="${list.catename }"></option>
                                    </select>
                                </div>
                                <div class="col-lg-6 col-md-6 form-group">
                                    <label class="control-label" for="inputWithSuccess2">详细类别</label>
                                    <input type="text" class="form-control" id="inputWithSuccess2" name="detailcate">
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-lg-12">
                                    <label class="control-label templatemo-block">图片</label>
                                    <!-- <input type="file" name="fileToUpload" id="fileToUpload" class="margin-bottom-10"> -->
                                    <input id="simple" name="fileToUpload" type="file" accept="image/png,image/jpeg,image/jpeg" multiple>
                                    <!-- <p>Maximum upload size is 5 MB.</p>  -->
                                </div>
                            </div>
                            <div class="form-group text-right">
                                <button type="submit" class="templatemo-blue-button">添加</button>
                                <button type="reset" class="templatemo-white-button">重置</button>
                            </div>
                        </form>




                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.content-wrapper -->

    <div th:replace="commons/public::footpublic"></div>
    <div th:replace="commons/public::controlpublic"></div>
    <!-- Control Sidebar -->

    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>




<!-- ./wrapper -->
<th:if test="${msg}">
    <input id="message" th:value="${msg}" hidden>
    <script type="text/javascript" th:inline="javascript">
        $(document).ready(function () {
            var msg = $("#message").val();
            if (msg !== "") {
                swal(msg);
            }
        });
    </script>
</th:if>

<script src="js/initFileInput.js"></script>
<script>
    //初始化单个按钮上传组件
    $("#simple").fileinput({
        language: 'zh',
        showCaption: false,
        dropZoneEnabled: false,
        showUpload:false,
        uploadAsync: false,
        layoutTemplates :{
            actionUpload:'',

        },
        uploadUrl: '/goods/addGoodsSuccess'

    });

</script>
</body>
</html>
